package controller;

import bean.Student;
import bean.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import service.StudentService;
import service.UserService;
import service.impl.UserServiceImpl;

import javax.servlet.http.HttpSession;
@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping("/login")
    public String delete(User user, HttpSession session){
        user=userService.login(user);
        if(user!=null)
        {
            session.setAttribute("user",user);
            return "redirect:/index.jsp";
        }
        return "redirect:/login.jsp";
    }
}
